<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
  <script>
    const originArr = [
      { id: 1, title: 'ipad', price: 5000, inventory: 2, quantity: 2 },
      { id: 2, title: 'HM T-shirt', price: 15, inventory: 8, quantity: 3 },
      { id: 3, title: 'CD', price: 20, inventory: 5, quantity: 2 },
    ];
    const value = originArr.reduce((accumulator, currentValue, currentIndex, array) => {
      console.log(accumulator, currentValue, currentIndex, array)
      return accumulator + currentValue.price * currentValue.quantity
    }, 0)
    console.log(value)
  </script>
</html>
